 
 <?php
	$model = new Default_Model_DbTable_Page ();
	$pages = $model->getAllPageHaveParent ( 0 );
	$controller_name = Zend_Controller_Front::getInstance ()->getRequest ()->getControllerName ();
	
	$page1 = $model->getAllPageHaveParent ( 4 );
	?>

<div id="header">
	<!-- .logo -->
	<div class="logo floatLeft">
		<img src="<?php echo TempDefault?>images/logo.png" alt="">
	</div>
	<!-- /.logo -->
	<!-- .menu-top -->
	<div class="menu-top floatRight">
		<!-- #menu -->
		<ul id="menu">
                	<?php foreach ($pages as $p ):?>
                    <li><a
				<?php if($controller_name == $p['CONTROLLER']):?> class="active"
				<?php endif;?> <?php if($p['CONTROLLER'] == ""):?> class="menuClick"
				<?php endif;?> href="<?php echo DOMAIN."/".$p['PAGE_NAME']?>"><?php echo $p['TITLE']?></a>
                    	<?php $childrens = $model->getAllPageHaveParent($p['ID']); ?>
                    	<?php if(sizeof($childrens) > 0):?>
                    
                    		                        	<?php foreach ($childrens as $child):?>
                    			                    		<?php if($child["MENU_ID"] == 4){?>
                    			                    		<?php }else{?>
                    			                    		<span class="down"> »</span>

				<ul class="sub-menu">
					<li><a href="<?php echo $child['PAGE_NAME']?>"><?php echo $child['TITLE']?></a></li>
				</ul>
                        <?php }?>
                    	                            <?php endforeach;?>
                    	
                    
                        <?php endif;?>
                    </li>
                    <?php endforeach;?>
                    
                </ul>
		<!-- /#menu -->
	</div>
	<!-- /.menu-top -->
	<div class="clear"></div>
</div>

<!-- .submenu -->
<div id="submenu" class="menu-1">
	<ul>
	<?php foreach ($page1 as $p):?>
		<li><a href="#"><?php echo $p["TITLE"]?></a> <!-- .subDisplay -->
			<div class="subDisplay">
				<!-- .colum -->
				<?php $subDisplay = $model->getAllPageHaveParent($p["ID"])?>
				
				<?php if($p["ID"]==8){?>
				<!-- /.colum -->
				<!-- .colum -->
					<?php for ($i;$i<=3;$i++){?>
					<?php if($i==1){?>
					<div class="colum">
					<ul>
						<p>Văn phòng</p>
						<?php foreach ($subDisplay as $s):?>
							<?php if($s["BLOCK"]=='văn phòng'){?>
							<li><a
							href="<?php echo DOMAIN."/noi-that-ngoai-that/".$s["ID"].".html"?>"><?php echo $s["TITLE"]?></a></li>
							<?php }?>
							<?php endforeach;?>
						</ul>
				</div>
					<?php }elseif($i==2){ ?>
						<div class="colum">
					<ul>
						<p>Nhà</p>
						<?php foreach ($subDisplay as $s):?>
							<?php if($s["BLOCK"]=='nhà'){?>
							<li><a
							href="<?php echo DOMAIN."/noi-that-ngoai-that/".$s["ID"].".html"?>"><?php echo $s["TITLE"]?></a></li>
							<?php }?>
							<?php endforeach;?>
						</ul>
				</div>
					<?php }elseif($i==3){?>
						<div class="colum">
					<ul>
						<p>Phòng khách</p>
						<?php foreach ($subDisplay as $s):?>
							<?php if($s["BLOCK"]=='phòng khách'){?>
							<li><a
							href="<?php echo DOMAIN."/noi-that-ngoai-that/".$s["ID"].".html"?>"><?php echo $s["TITLE"]?></a></li>
							<?php }?>
							<?php endforeach;?>
						</ul>
				</div>
					<?php }?>
					<?php }?> 
					<?php }?>
				<!-- /.colum -->
				<!-- .colum -->
					
				<?php if($p["ID"]== 9){?>
				<!-- /.colum -->
				<!-- .colum -->
					<?php for ($ii;$ii<=5;$ii++){?>
					<?php if($ii==1){?>
					<div class="colum">
					<ul>
						<p>Phòng ngủ</p>
						<?php foreach ($subDisplay as $s):?>
							<?php if($s["BLOCK"]=='phòng ngủ'){?>
							<li><a
							href="<?php echo DOMAIN."/noi-that-ngoai-that/".$s["ID"].".html"?>"><?php echo $s["TITLE"]?></a></li>
							<?php }?>
							<?php endforeach;?>
						</ul>
				</div>
					<?php }elseif($ii==2){ ?>
						<div class="colum">
					<ul>
						<p>Phòng trẻ</p>
						<?php foreach ($subDisplay as $s):?>
							<?php if($s["BLOCK"]=='phòng trẻ'){?>
							<li><a
							href="<?php echo DOMAIN."/noi-that-ngoai-that/".$s["ID"].".html"?>"><?php echo $s["TITLE"]?></a></li>
							<?php }?>
							<?php endforeach;?>
						</ul>
				</div>
					<?php }elseif($ii==3){?>
						<div class="colum">
					<ul>
						<p>Gian nhà bếp</p>
						<?php foreach ($subDisplay as $s):?>
							<?php if($s["BLOCK"]=='gian nhà bếp'){?>
							<li><a
							href="<?php echo DOMAIN."/noi-that-ngoai-that/".$s["ID"].".html"?>"><?php echo $s["TITLE"]?></a></li>
							<?php }?>
							<?php endforeach;?>
						</ul>
				</div>
					<?php }elseif($ii==4){?>
						<div class="colum">
					<ul>
						<p>Dụng cụ nhà bếp</p>
						<?php foreach ($subDisplay as $s):?>
							<?php if($s["BLOCK"]=='dụng cụ nhà bếp'){?>
							<li><a
							href="<?php echo DOMAIN."/noi-that-ngoai-that/".$s["ID"].".html"?>"><?php echo $s["TITLE"]?></a></li>
							<?php }?>
							<?php endforeach;?>
						</ul>
				</div>
					<?php }elseif($ii==5){?>
						<div class="colum">
					<ul>
						<p>Nhà tắm</p>
						<?php foreach ($subDisplay as $s):?>
							<?php if($s["BLOCK"]=='nhà tắm'){?>
							<li><a
							href="<?php echo DOMAIN."/noi-that-ngoai-that/".$s["ID"].".html"?>"><?php echo $s["TITLE"]?></a></li>
							<?php }?>
							<?php endforeach;?>
						</ul>
				</div>
					<?php }?>
					<?php }?> 
					<?php }?>
				<!-- /.colum -->
				<!-- .colum -->
								
								<?php if($p["ID"]== 10){?>
				<!-- /.colum -->
				<!-- .colum -->
					<?php for ($k;$k<=1;$k++){?>
					<?php if($k==1){?>
					<div class="colum">
					<ul>
						<p>Ngoại thất</p>
						<?php foreach ($subDisplay as $s):?>
							<?php if($s["BLOCK"]=='ngoại thất'){?>
							<li><a
							href="<?php echo DOMAIN."/noi-that-ngoai-that/".$s["ID"].".html"?>"><?php echo $s["TITLE"]?></a></li>
							<?php }?>
							<?php endforeach;?>
						</ul>
				</div>
					<?php }?>
					<?php }?> 
					<?php }?>
				<!-- /.colum -->
				<!-- .colum -->
			</div> <!-- /.subDisplay --></li>
	<?php endforeach;?>
	</ul>
</div>
<!-- /.submenu -->

<script type="text/javascript">
 	$(document).ready(function(){
 	 	$(".menuClick").click(function(){
 	 	 	$(".active").removeClass("active");
 	 	 	$(this).addClass("active");
 	 	 });
 	 });
</script>